
parameter logic[5:0] iop_lu	      = 6'b000000,
                     iop_li	      = 6'b000001,
                     iop_r1w1si	  = 6'b011???,
                     iop_r3w1	    = 6'b0001??,
                     iop_r2w1ti	  = 6'b00001?,
                     iop_memld	  = 6'b110???,
                     iop_memst	  = 6'b111???,
                     iop_cmp2r	  = 6'b0010??,
                     iop_cmp1ri	  = 6'b0011??,
                     iop_branch	  = 6'b010???,
                     iop_misc	    = 6'b100000;

typedef enum logic[8:0] {
	iop21_srlv,  	iop21_srav,  	iop21_sllv,    	iop21_rotv,
	iop21_uadd,  	iop21_add,  	iop21_usub,    	iop21_sub,
	iop21_or,    	iop21_nor,  	iop21_clo,    	iop21_clz,
	iop21_ext,  	iop21_ins,  	iop21_and,    	iop21_xor,
	iop21_umax,  	iop21_max,  	iop21_umin,    	iop21_min,
	iop21_seb,  	iop21_she,  	iop21_wsbh,      

	iop21_umul,  	iop21_mul,
  
	iop21_fmul = 9'b00100_0000,
	iop21_fadd,  	iop21_fsub,  	iop21_fmax,    	iop21_fmin,
	iop21_fabs,  	iop21_fdim,  	iop21_fround,  	iop21_ffloor,
	iop21_ftrunc,	iop21_fceil,
      
	iop21_srl = 9'b00101_0000,
              	iop21_sra,  	iop21_sll,    	iop21_rot,
	iop21_mv2s,  	iop21_i2f,
  
	op_cmp	  = 9'b00110_0000,	op_cmp[1:31],
	op_nop	  = 9'b01000_0000,    
              	op_bp0,     	op_bp1,       	op_bp2,
	op_bp3,      	op_lu,      	op_fmad,      	op_fmsu,
	op_mad,      	op_umad,    	op_msu,        	op_umsu,
	op_add3,    	op_mtsr,    	op_mfsr,
  
	op_br	    = 9'b01001_0000,	op_br[1:15],
	op_cop	  = 9'b01010_0000,	op_cop[1:31],
  
	iop21_udiv = 9'b10000_0000,
              	iop21_div,  	iop21_uquo,    	iop21_quo,
	iop21_ures,  	iop21_res,  	iop21_fdiv,    	iop21_fhypot,
	iop21_fexp2,	iop21_flog2,	iop21_frootn,  	iop21_fpow,
	iop21_fpown,	iop21_fpowr,	iop21_fsqrt,  	iop21_frsqrt,  
	iop21_sin,  	iop21_cos,  	iop21_tan,    	iop21_atan,
	iop21_sinh,  	iop21_cosh,  	iop21_tanh,    	iop21_atanh,
	iop21_fint
} iop21_e;

typedef enum logic[3:0] {
	memld_byte,  	memld_ubyte,	memld_half,    	memld_uhalf,
	memld_word,  	memld_link
}memld_e;

typedef enum logic[3:0] {
	memst_byte,  	memst_half,  	memst_word,    	memst_cond
}memst_e;

typedef enum logic[2:0] {
	cmptyp_equ,  	cmptyp_gt,  	cmptyp_ge,    	cmptyp_lt,  	cmptyp_le
}cmptyp_e;

typedef enum logic[4:0] {
	iop31_fmad,  	iop31_fmsu,  	iop31_imad,    	iop31_iumad,
	iop31_msu,  	iop31_umsu,  	iop31_add3
}iop31_e;

typedef struct packed unsigned {
	logic[5:0] op;
	logic[2:0] dummy;
	logic[5:0] rs2;
	logic[4:0] rs1;
	logic[5:0] rs0, rd;
}ilo_generic_s;

typedef struct packed unsigned {
	logic[2:0] dummy;
	logic[1:0] fun;
	logic[14:0] imm;
	logic[5:0] rs0, rd;
}ilo_r1w1si_s;

typedef struct packed unsigned {
	logic[3:0] op;
	logic[4:0] fun;
	logic[5:0] rs2;
	logic[4:0] rs1;
	logic[5:0] rs0, rd;
}ilo_r3w1_s;

typedef struct packed unsigned {
	logic[4:0] op;
	logic[8:0] fun;
	logic imm;
	logic[4:0] rs1;
	logic[5:0] rs0, rd;
}ilo_r2w1ti_s;

typedef struct packed unsigned {
	logic[1:0] op;
	logic[3:0] fun;
	logic a;
	logic[1:0] ch;
	logic[10:0] os;
	logic lg;
	logic[4:0] rb;
	logic[5:0] rd;
}ilo_memld_s;

typedef struct packed unsigned {
	logic[1:0] op;
	logic[3:0] fun;
	logic a;
	logic[1:0] ch;
	logic[10:0] os;
	logic lg;
	logic[4:0] rb;
	logic[5:0] rs;
}ilo_memst_s;

typedef struct packed unsigned {
	logic[3:0] op;
	logic m, f;
	logic[2:0] ctyp;
	logic[10:0] dummy;
	logic[5:0] rs1;
	logic[5:0] rs0;
}ilo_cmp2r_s;

typedef struct packed unsigned {
	logic[3:0] op;
	logic m, f;
	logic[2:0] ctyp;
	logic[10:0] imm0;
	logic[5:0] rs;
	logic[5:0] imm1;
}ilo_cmp1ri_s;

typedef struct packed unsigned {
	logic[2:0] op;
	logic[1:0] c;
	logic l;
	logic[12:0] imm0;
	logic r;
	logic[5:0] rs;
	logic[0:0] imm1;
	logic[4:0] rd;
}ilo_branch_s;

typedef struct packed unsigned {
	logic[5:0] op;
	logic dummy0, tf;
	logic[9:0] fea;
	logic[7:0] sr;
	logic[5:0] gr;
}ilo_mtfsr_s;

typedef struct packed unsigned {
	logic[5:0] op;
	logic[1:0] dummy0;
	logic[5:0] fun;
	logic[5:0] code;
	logic[5:0] rs, rd;
}ilo_cop_s;

typedef union packed unsigned {
	ilo_generic_s g;
	ilo_r1w1si_s 	r1w1;
	ilo_r3w1_s		r3w1;
	ilo_r2w1ti_s	r2w1;
	ilo_memld_s		ld;
	ilo_memst_s		st;
	ilo_cmp2r_s		cmp2r;
	ilo_cmp1ri_s	cmp1ri;
	ilo_branch_s	b;
	ilo_mtfsr_s		sr;
	ilo_cop_s	  	cop;
}ilo_inst_s;

